//  Gmof - A meta-object facility library based on OMG's EMOF 
//
//  Copyright (C) 2007 Peter Hagg <peter.hagg@iki.fi>
//
//  This library is free software; you can redistribute it and/or
//  modify it under the terms of the GNU Lesser General Public
//  License as published by the Free Software Foundation; either
//  version 2.1 of the License, or (at your option) any later version.
//
//  This library is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//  Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public
//  License along with this library; if not, write to the Free Software
//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
//
#include <cppunit/TestAssert.h>
#include <cppunit/Test.h>
#include <cppunit/TestSuite.h>
#include <cppunit/TestCaller.h>
#include <cppunit/extensions/HelperMacros.h>

#include "../src/gmof.h"

class PrimitiveTypesTest : public CppUnit::TestFixture 
{
	CPPUNIT_TEST_SUITE(PrimitiveTypesTest);

	CPPUNIT_TEST(test_boolean_creation);
	CPPUNIT_TEST(test_integer_creation);
	CPPUNIT_TEST(test_string_creation);
	
	CPPUNIT_TEST_SUITE_END();

private:
	Gmof::Package* package;

public:
	void setUp()
	{
		package = new Gmof::Package("TestPrimitiveTypes", "com.googlecode.gmof.test.enumeration");
	}

	void tearDown()
	{
		package->unreference();
	}
	
	void test_boolean_creation()
	{
		Gmof::Boolean* boolean = new Gmof::Boolean("test_boolean", package, "true");
		CPPUNIT_ASSERT(boolean);
		CPPUNIT_ASSERT(boolean->package = package);
		CPPUNIT_ASSERT(package->owned_type->size() == 1);
		CPPUNIT_ASSERT(boolean->value == true);
	}

	void test_integer_creation()
	{
		Gmof::Integer* integer = new Gmof::Integer("test_integer", package, "123");
		CPPUNIT_ASSERT(integer);
		CPPUNIT_ASSERT(integer->package = package);
		CPPUNIT_ASSERT(package->owned_type->size() == 1);
		CPPUNIT_ASSERT(integer->value == 123);
	}

	void test_string_creation()
	{
		Gmof::String* string = new Gmof::String("test_string", package, "TestString");
		CPPUNIT_ASSERT(string);
		CPPUNIT_ASSERT(string->package = package);
		CPPUNIT_ASSERT(package->owned_type->size() == 1);
		CPPUNIT_ASSERT(string->value == "TestString");
	}
};

//CPPUNIT_TEST_SUITE_REGISTRATION(PrimitiveTypesTest);

// End of file
